package club.caihappy.test;

import club.caihappy.config.MainConfigOfAutowired;
import club.caihappy.dao.BookDao;
import club.caihappy.pojo.Boss;
import club.caihappy.pojo.Car;
import club.caihappy.pojo.Color;
import club.caihappy.pojo.Yellow;
import club.caihappy.service.BookService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Created by DELL on 2021/10/9
 **/
public class IOCTest_Autowired {
    ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfAutowired.class);
    @Test
    public void test1(){
        Boss bean = applicationContext.getBean(Boss.class);

        System.out.println(bean);
        System.out.println(applicationContext.getBean(Car.class));

        System.out.println(applicationContext.getBean(Color.class));

        System.out.println(applicationContext);

//        System.out.println(bean);
//        BookDao bookDao2 = (BookDao) applicationContext.getBean("bookDao2");
//        System.out.println(bookDao2.getLabel());
    }

}
